//
//  TipMsgCell.m
//  ChangChat
//
//  Created by Cocoa on 2019/9/7.
//  Copyright © 2019 yibai. All rights reserved.
//

#import "TipMsgCell.h"

@implementation TipMsgCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    self.tipLabel = [KKPaddingLabel new];
    self.tipLabel.k_fontSize(12).k_textColor(UIColor.whiteColor);
    self.tipLabel.backgroundColor = UIColor.k_t4Color;
    self.tipLabel.padding = UIEdgeInsetsMake(3, 5, 3, 5);
    self.tipLabel.k_cornerRadius(3.0f);
    self.tipLabel.numberOfLines = 0;
    self.tipLabel.textAlignment = NSTextAlignmentCenter;
    self.tipLabel.preferredMaxLayoutWidth = Chat_MsgContent_MaxWidth;
    
    [self.msgContentView addSubview:self.tipLabel];
    [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.msgContentView);
        make.top.mas_offset(5);
        make.bottom.mas_offset(-5);
    }];
    
    [self.msgContentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(Chat_MsgContent_MaxWidth);
    }];
    self.iconImgView.hidden = YES;
    
}

- (void)setMsgModel:(MsgModel *)msgModel {
    [super setMsgModel:msgModel];
    
    if (msgModel.msg.type == MsgType_Tip) {
        self.tipLabel.text = msgModel.msg.content;
    } else {
        self.tipLabel.text = @"不支持的消息类型";
    }
}
@end
